
//package cfu_main.fir;
/*
 * This file creates the array of 8x8 CFU (total 64 CFUs). It verifies the functionality od FIR filter
 * Filter configuration: 
 * 		LCF = ; HCF = ;Sampling frequency =;Taps = 25; Number of channels = 1;
 * 		
 * 
 * 
 */

import java.lang.reflect.InvocationTargetException;
import javax.swing.JOptionPane;

//import java.io.*;
//import java.util.*;





class ISS_SIMD_FIR_16points_256samples
{
	
	/*Input arguments to this class will be in the following order
	 * 0- Instruction
	 * 1- 1st input register index 
	 * 2- 2nd input register index; pass null if not required
	 * 3- 3rd input register index; pass null if not required
	 * 4- Output register index
	 * 5- Shift offset	
	 */
	
	/*public static String no_cfu_row_string;
    public static String no_cfu_column_string ;
    public static String no_taps_string;
    public static String no_samples_string;
    public static String no_channels_string;*/

	public static int no_cfu_row_int ;
	public static int no_cfu_column_int ;
	public static int no_taps_int;
	public static int no_samples_int;
	public static int no_channels_int;
	public static int total_cfu,no_cfu_per_channel,unused_cfu;
	
	public static Cfu[][] Cfu_Array;

    public static Ram fir_ram;
    static int ram_size = 2048;

	

	//Cfu[][] Cfu_Array = new Cfu[no_cfu_row][no_cfu_column];
	//Cfu cfu1 = new Cfu(1,0,1,2,3,0);
	
	public static void Create_Cfu_Array()
    {
      //Creating array of 8x8 CFUs

		Cfu_Array = new Cfu[no_cfu_row_int][no_cfu_column_int];

		//Initializing with default constructors
		for (int i=0;i<no_cfu_row_int;i++)
		{
			for(int j=0;j<no_cfu_column_int;j++)
			{

				Cfu_Array[i][j] = new Cfu();
			}

		}
    }


    public static void Create_RAM()
    {
        fir_ram = new Ram(ram_size);
        fir_ram.Load_Coefficients();
        fir_ram.Load_Data();

    }

    
    
	public static void main (String[] args) throws InterruptedException, InvocationTargetException
	{
/*		Ram ram_fir = new Ram;

		String ram_size_string = JOptionPane.showInputDialog(null,"Enter RAM size:");
		int ram_size_int = Integer.parseInt(ram_size_string);

		ram_fir.Ram(ram_size_int);*/
		JOptionPane.showMessageDialog(null,"Jai Sairam..The program started...!");
//		java.awt.EventQueue.invokeAndWait(new Runnable() {
//            @Override
//            public void run() {
//                JOptionPane.showMessageDialog(null,"Jai Sairam..The program started 1.1...!");
//                new ISS_SIMD_FIR_form().setVisible(true);
//                JOptionPane.showMessageDialog(null,"Jai Sairam..The program started 1.2...!");
//            }
//        });
		/*no_cfu_row_string = JOptionPane.showInputDialog("Please, enter no of rows for CFU array");
		no_cfu_column_string = JOptionPane.showInputDialog("Please, enter no of columns for CFU array");
		no_taps_string = JOptionPane.showInputDialog("Please, enter no of taps in  FIR filter");
		no_samples_string = JOptionPane.showInputDialog("Please,enter no of samples to process");
		no_channels_string =  JOptionPane.showInputDialog("Please, enter no of channels you want process in parallel");*/
		
		/*no_cfu_row_int = Integer.parseInt(no_cfu_row_string);
		no_cfu_column_int = Integer.parseInt(no_cfu_column_string);
		no_taps_int = Integer.parseInt(no_taps_string);
		no_samples_int = Integer.parseInt(no_samples_string);
		no_channels_int = Integer.parseInt(no_channels_string);*/
		
		/*total_cfu = no_cfu_column_int * no_cfu_row_int;
		no_cfu_per_channel =  total_cfu / no_channels_int;
		unused_cfu = total_cfu - (no_cfu_per_channel * no_channels_int);*/
		
		//JOptionPane.showMessageDialog(null, "no_cfu_per_channel= " + no_cfu_per_channel+"channels "+no_channels_int+" unused" + unused_cfu );
		
		
			
		
		//Cfu_Array[0][0].Cfu_initialize(1, 0, 1, 2, 3, 0);
		//Create_Cfu_Array();

		//Initializing RAM
		//Create_RAM();

       
		//Loading data from RAM to CFU array
		
	
		
		//for (int i=0;i<(no_taps_int%no_cfu_column_int);i++)
		{
			
		}
		//JOptionPane.showMessageDialog(null, "no_cfu_per_channel= ");
		//JOptionPane.showMessageDialog(null,"Jai Sairam..The program started 3...!");
		//Cfu cfu1 = new Cfu(4,0,1,2,3,0);
		
		//cfu1.start_CFU();

//		Cfu_Array[0][1].update_register(1, 65);
//        Cfu_Array[0][1].update_register(0, 65);
//		Cfu_Array[0][0].Cfu_initialize(1, 0, 1, 2, 3, 0);
//		Cfu_Array[0][0].start_CFU();
		
		System.exit(0);
	}
	
	
	
}
	
